class WelcomeController < ApplicationController
  
  def index
    session[:user_id] = nil
    if request.post?
      user = User.authenticate(params[:name], params[:password])
      if user
        session[:user_id] = user.id
        uri = session[:original_uri]
        session[:original_uri] = nil
        redirect_to(uri || {:controller => "admin"})
      else
        flash[:notice] = "Couple login/password invalide!"
      end
    end
  end
  
end
